<?php

namespace app\dao\portal;

use app\dao\BaseDao;
use app\model\portal\FacadeMajor;

class PortalMajorDao extends BaseDao
{

    public function index($where)
    {
        return $this->search()->where('website_id', $where['website_id'])->paginate($where['pageSize']);
    }

    public function create(array $where)
    {
        return $this->getModel()->create($where);
    }

    public function updateDao($where)
    {
        return $this->search()->update($where);
    }

    public function deleteDao(array $where)
    {
        return $this->getModel()-> whereIn('id',$where['id']) -> update(['delete_time' => date('Y-m-d H:i:s', time())]);
    }

    public function searchTitle(array $where)
    {
        return $this -> getModel()::withSearch(['title'],['title' => $where['title']]) ->where('website_id',$where['website_id']) -> paginate($where['pageSize']);
    }

    protected function setModel(): string
    {
        return FacadeMajor::class;
    }
}